from pydantic import BaseModel
from typing import Optional
from datetime import datetime

# Resource base schema
class ResourceBase(BaseModel):
    name: str
    type: str
    path: str
    version: Optional[str] = None
    description: Optional[str] = None
    related_case_id: Optional[int] = None

# Resource creation schema
class ResourceCreate(ResourceBase):
    pass

# Resource update schema
class ResourceUpdate(BaseModel):
    name: Optional[str] = None
    type: Optional[str] = None
    path: Optional[str] = None
    version: Optional[str] = None
    description: Optional[str] = None
    related_case_id: Optional[int] = None

# Resource response schema
class ResourceResponse(ResourceBase):
    id: int
    created_at: datetime
    updated_at: datetime

    class Config:
        orm_mode = True